<template>
    <div>
        <!-- 供应商报价 -->
        <div class="product">
            <h2>供应商报价详情</h2>

            <el-table :data="tableForm.tableData3" border style="width: 90%; margin: 5px auto 30px;">
                <el-table-column prop="displayName" label="供应商名称">
                    <template slot-scope="scope">
                        <div @click="alertSupplier(scope.row)">
                            <a href="javascript:;">{{ scope.row.displayName }}</a>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="price" label="供应商报价">
                </el-table-column>
                <el-table-column prop="minQty" label="最低采购数量">
                </el-table-column>
            </el-table>

        </div>
        <!-- 供应商详情弹框 -->
        <div v-if="openPartner">
        <el-dialog :visible.sync="openSupplier" width="1500px" append-to-body @close='closeDialog'>
            <Supplierdetail :fid="partnerId"></Supplierdetail>
        </el-dialog>
    </div>
    </div>
</template>
<script>
import { getSupplierinfo} from "@/api/system/stock";
import Supplierdetail from '@/views/system/supplierdetail/index'
export default {
    data() {
        return {
            //创建销毁弹框
            openPartner:false,
            //传给子组件的id
            partnerId:null,
             // 供应商详情弹框
             openSupplier: false,
            // 供应商报价
            tableForm: {
                tableData3: []
            },     
        };
    },
    mounted() {
        // 通过$route.query将传过来的值接收;
        let id = this.$route.query.listId;
        this.getSupplierinfo(id)
    },
    methods: {


        //供应商报价
        getSupplierinfo(id) {
            getSupplierinfo(id).then(res => {
                // console.log(res);
                this.tableForm.tableData3 = res.data
            })
        },
         // 点击供应商名称弹出详情
        alertSupplier(row) {
            // console.log(row);
             this.openSupplier = true
             this.partnerId = row.partnerId
            this.openPartner = true
        },
         // 关闭弹框的时候销毁内容  再次点击重新创建
         closeDialog() {
            this.showStock=false
        }




    },
    components: {
        Supplierdetail,
    },
    props: {},
    watch: {},
    computed: {},
    created() { },
};
</script>
<style lang="scss" scoped>
h2 {
    text-align: center;
    line-height: 60px;
}

.btn {
    margin-left: 5%;
}

.thRed {
    // height: 200px;
    margin-top: 22px;
}
</style>